package com.mlh.controller;

import com.mlh.entity.User;
import com.mlh.service.UserService;
import com.mlh.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 缪林辉
 * @date 2024/3/16 16:04
 * @DESCRIPTION
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/userInfo")
    public ResponseResult userInfo(){
        return userService.getUserInfo();
    }

    @PutMapping("/userInfo")
    public ResponseResult updateuserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")
    public ResponseResult userRegister(@RequestBody User user){
        return userService.userRegister(user);
    }
}
